home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / util / wb / DockNet20_src.lha / DockNet.e < prev    next >
Text File  |  1998-10-15  |  6KB  |  185 lines

  1. /* Start of DockNet */
  2. OPT PREPROCESS
  3. #define STR [256]:STRING
  4. MODULE 'utility/tagitem','dos/dos'
  5. MODULE 'libraries/gadtools'
  6. MODULE'muimaster','libraries/mui','libraries/muip','mui/muicustomclass','amigalib/boopsi','intuition/classes','intuition/classusr','intuition/screens','intuition/intuition'
  7. MODULE'tools/boopsi'
  8. MODULE'utility/hooks'
  9. ENUM NULL,ID_EPROGA, ID_EPROGB, ID_EPROGC, ID_EPROGD, ID_EPROGE, ID_EPROGF, ID_EPROGG, ID_EPROGH, ID_EPROGI
  10.  
  11. PROC main() HANDLE
  12.  
  13.  
  14.  
  15.  
  16. /*
  17. DEFINIR VARs DA GUI COM DEF ... E TB OUTRAS VARs
  18.  
  19.  
  20. */
  21.  
  22.  
  23. DEF app,sigs,wi_label_0,running,result,file,btp1,btp2,btp3,btp4,btp5,btp6,btp7,btp8,btp9,pg1 STR,pg1p STR,pg2 STR,pg2p STR,pg3 STR,pg3p STR,pg4 STR,pg4p STR,pg5 STR,pg5p STR,pg6 STR,pg6p STR,pg7 STR,pg7p STR,pg8 STR,pg8p STR,pg9 STR,pg9p STR
  24. file := Open('ENV:DockNet/DockNet.prefs', OLDFILE)
  25. ReadStr(file,pg1)
  26. ReadStr(file,pg1p)
  27. ReadStr(file,pg2)
  28. ReadStr(file,pg2p)
  29. ReadStr(file,pg3)
  30. ReadStr(file,pg3p)
  31. ReadStr(file,pg4)
  32. ReadStr(file,pg4p)
  33. ReadStr(file,pg5)
  34. ReadStr(file,pg5p)
  35. ReadStr(file,pg6)
  36. ReadStr(file,pg6p)
  37. ReadStr(file,pg7)
  38. ReadStr(file,pg7p)
  39. ReadStr(file,pg8)
  40. ReadStr(file,pg8p)
  41. ReadStr(file,pg9)
  42. ReadStr(file,pg9p)
  43. Close(file)
  44.   IF (muimasterbase:=OpenLibrary(MUIMASTER_NAME,MUIMASTER_VMIN))=NIL THEN
  45.     Raise('Failed to open muimaster.library')
  46.  
  47.          app := ApplicationObject,
  48.                 MUIA_Application_Author, 'Luis Domingos',
  49.                 MUIA_Application_Base, 'NetDock',
  50.                 MUIA_Application_Version, '$VER: Luis 02.00 (14.10.98)',
  51.                 MUIA_Application_Copyright, 'c1997 Luis',
  52.                 MUIA_Application_Description, 'Launch Net Apps',
  53.                 SubWindow, wi_label_0:=WindowObject,
  54.                 MUIA_Window_Title, 'DockNet',
  55.                 MUIA_Window_ID, "0WIN",
  56.                 MUIA_Window_SizeGadget, 1,
  57.                 WindowContents, HGroup,
  58.                    Child, btp1 := SimpleButton(pg1),
  59.                    Child, btp2 := SimpleButton(pg2),
  60.                    Child, btp3 := SimpleButton(pg3),
  61.                    Child, btp4 := SimpleButton(pg4),
  62.                    Child, btp5 := SimpleButton(pg5),
  63.                    Child, btp6 := SimpleButton(pg6),
  64.                    Child, btp7 := SimpleButton(pg7),
  65.                    Child, btp8 := SimpleButton(pg8),
  66.                    Child, btp9 := SimpleButton(pg9),
  67.                  End,
  68.               End,
  69.            End
  70.  
  71.  
  72.   IF (app=NIL) THEN
  73.       Raise('Failed to create Application.')
  74.  
  75. /*
  76. ** Install notification events...
  77. */
  78. doMethod(btp1, [MUIM_Notify, MUIA_Pressed, MUI_TRUE,app, 2,MUIM_Application_ReturnID,ID_EPROGA,MUI_TRUE])
  79. doMethod(btp2, [MUIM_Notify, MUIA_Pressed, MUI_TRUE,app, 2,MUIM_Application_ReturnID,ID_EPROGB,MUI_TRUE])
  80. doMethod(btp3, [MUIM_Notify, MUIA_Pressed, MUI_TRUE,app, 2,MUIM_Application_ReturnID,ID_EPROGC,MUI_TRUE])
  81. doMethod(btp4, [MUIM_Notify, MUIA_Pressed, MUI_TRUE,app, 2,MUIM_Application_ReturnID,ID_EPROGD,MUI_TRUE])
  82. doMethod(btp5, [MUIM_Notify, MUIA_Pressed, MUI_TRUE,app, 2,MUIM_Application_ReturnID,ID_EPROGE,MUI_TRUE])
  83. doMethod(btp6, [MUIM_Notify, MUIA_Pressed, MUI_TRUE,app, 2,MUIM_Application_ReturnID,ID_EPROGF,MUI_TRUE])
  84. doMethod(btp7, [MUIM_Notify, MUIA_Pressed, MUI_TRUE,app, 2,MUIM_Application_ReturnID,ID_EPROGG,MUI_TRUE])
  85. doMethod(btp8, [MUIM_Notify, MUIA_Pressed, MUI_TRUE,app, 2,MUIM_Application_ReturnID,ID_EPROGH,MUI_TRUE])
  86. doMethod(btp9, [MUIM_Notify, MUIA_Pressed, MUI_TRUE,app, 2,MUIM_Application_ReturnID,ID_EPROGI,MUI_TRUE])
  87. doMethod(wi_label_0, [MUIM_Notify, MUIA_Window_CloseRequest, MUI_TRUE, app,2,MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit,MUI_TRUE])
  88.  
  89.  
  90. /*
  91. ** This is the ideal input loop for an object oriented MUI application.
  92. ** Everything is encapsulated in classes, no return ids need to be used,
  93. ** we just check if the program shall terminate.
  94. ** Note that MUIM_Application_NewInput expects sigs to contain the result
  95. ** from Wait() (or 0). This makes the input loop significantly faster.
  96. */
  97.  
  98.   set(wi_label_0,MUIA_Window_Open,MUI_TRUE)
  99.  
  100.    running := TRUE  /* Not for MUI -> no need to use MUI_TRUE */
  101.  
  102.    WHILE running
  103.  
  104.       result := doMethod(app, [MUIM_Application_Input, {sigs} ])
  105.  
  106.       SELECT result
  107.  
  108.          CASE MUIV_Application_ReturnID_Quit
  109.             running := FALSE
  110.  
  111.          CASE ID_EPROGA
  112.             Execute(pg1p, NIL, NIL)
  113.  
  114.  
  115.          CASE ID_EPROGB
  116.             Execute(pg2p, NIL, NIL)
  117.  
  118.  
  119.          CASE ID_EPROGC
  120.             Execute(pg3p, NIL, NIL)
  121.  
  122.  
  123.          CASE ID_EPROGD
  124.             Execute(pg4p, NIL, NIL)
  125.  
  126.  
  127.          CASE ID_EPROGE
  128.             Execute(pg5p, NIL, NIL)
  129.  
  130.  
  131.          CASE ID_EPROGF
  132.             Execute(pg6p, NIL, NIL)
  133.  
  134.  
  135.          CASE ID_EPROGG
  136.             Execute(pg7p, NIL, NIL)
  137.  
  138.  
  139.          CASE ID_EPROGH
  140.             Execute(pg8p, NIL, NIL)
  141.  
  142.  
  143.          CASE ID_EPROGI
  144.             Execute(pg9p, NIL, NIL)
  145.  
  146.  
  147.       ENDSELECT
  148.     IF sigs THEN Wait(sigs)
  149.  
  150.   ENDWHILE
  151.  
  152.  
  153.  
  154.   set(wi_label_0,MUIA_Window_Open,FALSE)
  155.  
  156. /*
  157. ** Shut down...
  158. */
  159.  
  160. EXCEPT DO
  161.   IF app THEN Mui_DisposeObject(app)
  162.   IF muimasterbase THEN CloseLibrary(muimasterbase)
  163.   IF exception THEN WriteF('\s\n',exception)
  164. ENDPROC
  165.  
  166. PROC doMethod( obj:PTR TO object, msg:PTR TO msg )
  167.  
  168.     DEF h:PTR TO hook, o:PTR TO object, dispatcher
  169.  
  170.     IF obj
  171.         o := obj-SIZEOF object    /* instance data is to negative offset */
  172.         h := o.class
  173.         dispatcher := h.entry    /* get dispatcher from hook in iclass */
  174.         MOVEA.L h,A0
  175.         MOVEA.L msg,A1
  176.         MOVEA.L obj,A2        /* probably should use CallHookPkt, but the */
  177.         MOVEA.L dispatcher,A3    /*   original code (doMethod()) doesn't. */
  178.         JSR (A3)        /* call classDispatcher() */
  179.         MOVE.L D0,o
  180.         RETURN o
  181.     ENDIF
  182. ENDPROC NIL
  183.  
  184. /* End of DockNet */
  185.